package de.baumann.browser.fragments.explore

import android.view.View
import de.baumann.browser.R
import de.baumann.browser.adapter.ExploreOdinDestroyRecordAdapter
import de.baumann.browser.api.net.vo.explore.OdinDestroyBean
import de.baumann.browser.base.BaseOdinFragment
import de.baumann.browser.iview.explore.IOdinDestroyRecordView
import de.baumann.browser.present.explore.OdinDestroyPresenter
import kotlinx.android.synthetic.main.fragment_destroy_odin_record.*


class OdinDestroyRecordFragment : BaseOdinFragment<IOdinDestroyRecordView, OdinDestroyPresenter>(), IOdinDestroyRecordView {
    override fun getLayout(): Int {
        return R.layout.fragment_destroy_odin_record
    }

    companion object {
        val instance: OdinDestroyRecordFragment by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
            OdinDestroyRecordFragment()
        }
    }

    private lateinit var exploreAdapters: ExploreOdinDestroyRecordAdapter
    override fun initView(view: View) {
        exploreAdapters = ExploreOdinDestroyRecordAdapter()
        rvDestroy.adapter = exploreAdapters
    }

    override fun initData() {
    }

    override fun onResume() {
        super.onResume()
        getPresenter().getOdinDestroyList()
    }

    override fun createPresenter(): OdinDestroyPresenter? {
        return OdinDestroyPresenter()
    }

    override fun createView(): IOdinDestroyRecordView? {
        return this
    }

    override fun getOdinDestroy(list: List<OdinDestroyBean>) {
        exploreAdapters.setNewData(list)
    }


}